<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<!--
        IE=edge：让IE使用最新的渲染模式，针对ie8 (7,8的渲染模式是不一样的)
        http://blog.csdn.net/www3300300/article/details/12992489
    -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--
        针对移动设备,网站显示宽度等于设备屏幕显示宽度,内容缩放比例为1:1
        http://www.cnblogs.com/yuzhongwusan/p/4184923.html
    -->
<meta name="viewport" content="width=device-width, initial-scale=1">

<!--将下面的 <meta> 标签加入到页面中，可以让部分国产浏览器默认采用高速模式渲染页面：-->
<meta name="renderer" content="webkit">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>Bootstrap 101 Template</title>

<!-- Bootstrap -->
<link href="websrc/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="websrc/css/mydeck.css">
<link rel="stylesheet" href="websrc/css/common.css">
<link rel="stylesheet" href="websrc/css/login.css">


<!--下面这一大块的注释是说:"为了让IE9以下的浏览器支持响应式和HTML5标签.需要引入下面两个JS文件"-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<script src="websrc/js/jquery-3.2.1.js"></script>
<script src="websrc/js/jquery.cookie.js" type="text/javascript"></script>
</head>
<body>
	<div class="header clearfix">
		<!--<div class="header-left clearfix">-->
		<!--<div class="logo">LOGO</div>-->
		<!--<div class="projectName">记忆宫殿</div>-->
		<!--<div class="projectEnglishName">Memory Palace</div>-->
		<!--</div>-->
		<!--<div class="header-middle">-->
		<!--个人首页/学习列表/浏览牌组/知识结构/我的商城-->
		<!--</div>-->
		<!--<div class="header-right">-->
		<!--wing-->
		<!--</div>-->
		<nav class="navbar navbar-default">
			<div class="container-fluid">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed"
						data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
						aria-expanded="false">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="navbar-brand header-left clearfix" href="#">
						<div class="logo">LOGO</div>
						<div class="projectName">记忆宫殿</div>
						<div class="projectEnglishName">Memory Palace</div>
					</a>
				</div>


				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse"
					id="bs-example-navbar-collapse-1">


					<ul class="nav navbar-nav navbar-right"
						style="padding-top: 28px;padding-right: 10px">
						<li><span>还没有帐号？<a href="register.jsp">请注册</a></span></li>
					</ul>
				</div>
				<!-- /.navbar-collapse -->
			</div>
			<!-- /.container-fluid -->
		</nav>
	</div>


	<script type="text/javascript">
		var denglu = function() {
			/* var user_login = document.getElementById("user_login");
			var trimstr = user_login.value.trim(); */
			var lengthstr = user_login.value.trim().length;
			var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
			if (user_login.value != null && lengthstr > 0) {
	
				if (user_login.value.match(reg)) {
	
					document.getElementById("user_Email").value = user_login.value;
	
				} else {
					document.getElementById("user_Name").value = user_login.value;
	
				}
	
				document.getElementById('loginfrom').submit();
	
			}
		};
	
	
		//初始化页面时验证是否记住了密码 
		$(document).ready(function() {
			if ($.cookie("rmbUser") == "true") {
				$("#rmbUser").attr("checked", true);
				$("#user_login").val($.cookie("userName"));
				$("#user_password").val($.cookie("passWord"));
			}
		});
		//保存用户信息 
		function denglu() {
			if ($("#rmbUser").attr("checked") == true) {
				var userName = $("#user_login").val();
				var passWord = $("#user_password").val();
				$.cookie("rmbUser", "true", {
					expires : 7
				}); // 存储一个带7天期限的 cookie 
				$.cookie("userName", userName, {
					expires : 7
				}); // 存储一个带7天期限的 cookie 
				$.cookie("passWord", passWord, {
					expires : 7
				}); // 存储一个带7天期限的 cookie 
			} else {
				$.cookie("rmbUser", "false", {
					expires : -1
				});
				$.cookie("userName", '', {
					expires : -1
				});
				$.cookie("passWord", '', {
					expires : -1
				});
			}
		}
	</script>
	<div id="wrapper" class="login-page">
		<div id="login_form" class="form">
			<form class="login-form" id="loginfrom"
				action="<c:url value="/checkuser_userandpsd.action"/>" method="post">
				<span style="color:red;margin-right:150px">${msg}</span> <input
					type="hidden" id="user_Name" name="userName" /> <input
					type="hidden" id="user_Email" name="userEmail" /> <input
					type="text" class="denglu" placeholder="用户名/邮箱 " id="user_login" "/>
				<input type="password" placeholder="密码" name="userPwd"
					id="user_password" /> <input type="checkbox" checked="true"
					style="margin-left: 150px;width: 50px" id="rmbUser" /><span
					for="rmbUser">记住密码</span> <input type="button" value="登录"
					style="background-color: #43A047;color: white;" onclick="denglu()" />
				<p class="message">
					还没有账户? <a href="<c:url value="/register.jsp"></c:url>">立刻创建</a>
				</p>
			</form>
		</div>
	</div>


















	<!--中:必须在JS文件引入之前引入JQ文件,这里src引用的是本地.线上建议使用CDN引用)
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed，bootstrap.min.js是基于jquery的 -->
	<script src="websrc/js/bootstrap.min.js"></script>
</body>
</html>